<template>
  <div class="bigBox">
    <div class="menuBox">
      <div class="screen" v-for="item in menu" v-bind:key="item.id">
        <span class="symbol">|</span>
        <span class="title">{{ item.title }}:</span>
        <span
          class="smallTitle"
          :class="{'active':(cid === child.id && fid === item.id)}"
          v-for="child in item.children2"
          v-bind:key="child.id"
          @click="sendChangeTitle(item.id, child.id)"
          >{{ child.title }}</span
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    menu: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
        fid:0,
        cid:0,
        changeColor:true
    };
  },
  methods:{
      sendChangeTitle(fid, cid){
          console.log('打印成功', fid, cid);
          this.fid = fid
          this.cid = cid
          this.$emit("getIdValue", this.fid, this.cid)
      }
  }
};
</script>

<style lang="less" scoped>
.menuBox {
  background-color: #ffe5e5;
  margin: 45px;
  padding: 40px;
  .screen {
    margin-top: 20px;
    margin-left: 20px;
    font-size: 25px;
    font-weight: 1000;
    .symbol {
      color: red;
      font-size: 28px;
    }
    .title {
      margin: 0 10px;
    }
    .smallTitle {
      font-weight: 500;
      margin: 0 10px;
      margin-right: 60px;
    }
    .active{
        border: 1px solid ;
        border-radius: 30px;
        background-color: red;
        color: #fff;
        padding: 5px;
    }
  }
}
</style>
